/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ken
 * Date: 2024-01-11
 * Time: 18:55
 */
public class Sort {       // 直插排序
    public static void insertSort(int[] arry) {
        for (int i = 0; i < arry.length; i++) {
            int temp = arry[i];
            int k = i-1;
            while(k >= 0) {
                if(arry[k] > temp) {
                    arry[k+1] = arry[k];
                } else {
                    //arry[k+1] = temp;
                    break;
                }
                k--;
            }
            arry[k+1] = temp;
        }
    }
}
